package cn.lyjuan.android.demofive.ui.component.time_picker;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.TimePicker;
import cn.lyjuan.android.demofive.R;

/**
 * Created by chad on 2016/1/20.
 */
public class TimePickerActivity extends Activity {

    TextView text;
    TimePicker timePicker;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.setContentView(R.layout.ui_time_picker);

        text = (TextView) this.findViewById(R.id.ui_time_picker_text);
        timePicker = (TimePicker) this.findViewById(R.id.ui_time_picker_picker);

        timePicker.setOnTimeChangedListener(timeChangedListener);
    }

    private TimePicker.OnTimeChangedListener timeChangedListener = new TimePicker.OnTimeChangedListener() {
        @Override
        public void onTimeChanged(TimePicker view, int hourOfDay, int minute) {
            text.setText("时间：" + hourOfDay + ":" + minute);
        }
    };
}
